package MonkeyAssistant;

public class MonkeyAssistant {
    private String name;
    private int age;
    private double weight;
    private String hobby = "Swinging from trees";
    private double temperature = 0.0;

    public MonkeyAssistant(String name, int age, double weight) {
        this.name = name;
        this.age = age;
        this.weight = weight;
    }

    public void climbTree()
    {
        System.out.println("Monkey " + name + " is climbing a tree.");
    }

    public void printDetails()
    {
        System.out.println("Name: " + name);
        System.out.println("Age: " + age);
        System.out.println("Weight: " + weight);
        System.out.println("Hobby: " + hobby);
    }

    public void setTemperature(double temperature)
    {
        temperature = temperature;
    }

    public double celsiusToFahrenheit(double celsius)
    {
        return (celsius * 9 / 5) + 32;
    }

    public double celsiusToFahrenheit(int celsius)
    {
        return celsiusToFahrenheit((double)celsius);
    }

    public double fahrenheitToCelsius(double fahrenheit)
    {
        return (fahrenheit - 32) * 5 / 9;
    }

    public double fahrenheitToCelsius(int fahrenheit)
    {
        return fahrenheitToCelsius((double)fahrenheit);
    }

    public static void main(String[] args) {
        // 使用默认构造方法创建对象
        MonkeyAssistant assistant1 = new MonkeyAssistant("Default", 0, 0.0);
        // 使用带有参数的构造方法创建对象
        MonkeyAssistant assistant2 = new MonkeyAssistant("皮皮", 2, 48.0);

        // 打印详细信息
        assistant1.printDetails();
        System.out.println(); // 分隔输出
        assistant2.printDetails();

        // 猴子爬树行为
        assistant1.climbTree();
        System.out.println(); // 分隔输出
        assistant2.climbTree();

        // 温度转换示例
        assistant1.setTemperature(20); // 设置温度为20°C
        System.out.println("20°C in Fahrenheit is: " + assistant1.celsiusToFahrenheit(20));
        System.out.println("72°F in Celsius is: " + assistant1.fahrenheitToCelsius(72));
    }


}
